home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / modelers / geomview / source.lha / Geomview / include / streampool.h < prev    next >
C/C++ Source or Header  |  1993-04-01  |  4KB  |  106 lines

  1. /* Copyright (c) 1992 The Geometry Center; University of Minnesota
  2.    1300 South Second Street;  Minneapolis, MN  55454, USA;
  3.    
  4. This file is part of geomview/OOGL. geomview/OOGL is free software;
  5. you can redistribute it and/or modify it only under the terms given in
  6. the file COPYING, which you should have received along with this file.
  7. This and other related software may be obtained via anonymous ftp from
  8. geom.umn.edu; email: software@geom.umn.edu. */
  9.  
  10. /* Authors: Charlie Gunn, Stuart Levy, Tamara Munzner, Mark Phillips */
  11.  
  12. #ifndef _STREAMPOOL_
  13. #define    _STREAMPOOL_
  14.  
  15. #include <sys/types.h>
  16. #include <sys/time.h>
  17. #include "handle.h"
  18.  
  19.  
  20.     /*
  21.      * Common stream syntax
  22.      */
  23.  
  24. #define    CBRA    '{'
  25. #define    CKET    '}'
  26.  
  27.  
  28.     /*
  29.      * Open a stream-type Pool.
  30.      * Uses stream f if != NULL, otherwise opens the named file.
  31.      * The name is required anyway, to uniquely identify the pool.
  32.      */
  33. extern Pool *PoolStreamOpen(char *name, FILE *f, int rw, HandleOps *ops);
  34.  
  35.     /*
  36.      * Open a temporary Pool.  Like PoolStreamOpen, but:
  37.      *   - the opened Pool is not listed as a input source for PoolInputFDs
  38.      *   - it is not added to the table of known Pools, so
  39.      *    it won't conflict with other Pools known by the same name.
  40.      * Uses stream f if != NULL, otherwise opens the named file.
  41.      * The name is not required -- it may be NULL.
  42.      */
  43. extern Pool *PoolStreamTemp(char *name, FILE *f, int rw, HandleOps *ops);
  44.  
  45.     /*
  46.      * Return the set of file descriptors pool file descriptors we'd like
  47.      * polled for input.  Fills *maxfd with the highest+1 file descriptor.
  48.      * Returns 0 if some pool holds buffered input (i.e. don't let select()
  49.      * block), otherwise the time in seconds until the next sleeping Pool
  50.      * awakens.  If no Pools are asleep, returns a large positive number.
  51.      */
  52. extern float PoolInputFDs( fd_set *fds, int *maxfd );
  53.  
  54.     /*
  55.      * Given the fd mask returned by select(), call import() on
  56.      * all pools which have input.  Removes used fd's from *fds;
  57.      * decrements count for each fd used.
  58.      * Returns 1 if anything read from any pool, 0 otherwise.
  59.      */
  60. extern int PoolInAll( fd_set *fds, int *count );
  61.  
  62.     /*
  63.      * Utility routine for XXXOut functions.
  64.      * Writes relevant text of h to the Pool based on p's output setup;
  65.      * returns 1 if associated data should be written too, 0 if not.
  66.      */
  67. extern int PoolStreamOutHandle(Pool *p, Handle *h, int havedata);
  68.  
  69.     /*
  70.      * Set a pool's client data pointer.  Pool users may use
  71.      * this for whatever they want.
  72.      */
  73. void PoolSetClientData(Pool *p, void *data);
  74.  
  75.     /*
  76.      * Return a pool's client data pointer.
  77.      */
  78. void *PoolClientData(Pool *p);
  79.  
  80. extern void PoolDelete(Pool *p);
  81.  
  82.                 /* How much to export when we do so? */
  83.                 /* Pass these values to PoolSetOType(). */
  84. #define      PO_ALL    0    /*   - use all handles and all data */
  85. #define      PO_HANDLES    1    /*   - use handles wherever possible, avoid data */
  86. #define      PO_DATA    2    /*   - data, no external refs */
  87.  
  88. extern FILE *PoolInputFile(Pool *);
  89. extern FILE *PoolOutputFile(Pool *);
  90. extern void  PoolDoReread(Pool *);
  91. extern void PoolClose(register Pool *p);
  92. extern int   PoolOType(Pool *, int otype);
  93. extern void  PoolSetOType(Pool *, int otype);
  94. extern Pool *PoolByName(char *name);
  95. extern char *PoolName(Pool *);
  96.  
  97. extern void PoolSleepFor(Pool *, double seconds);
  98. extern void PoolSleepUntil(Pool *, double seconds);
  99. extern void PoolSetTime(Pool *, struct timeval *basis, double time_at_basis);
  100. extern double PoolTimeAt(Pool *, struct timeval *at_this_time);
  101. extern void PoolAwaken(Pool *);
  102.  
  103. extern int PoolIncLevel(Pool *p, int incr);
  104.  
  105. #endif /*_STREAMPOOL_*/
  106.